import time

from common.BasePages import BasePage


class AlarmInformation(BasePage):
    # 报警信息
    def alarm_information_url(self):
        self.goto_url("alarmManagement/alarmInfoMax")

    def set_alarm_information(self):
        response = self.cat_url(self.page.get_by_role("button", name=" 查询"), "AlarmRule")  # 获取接口响应的结果。
        print(response)
        # assert response['Data']['Items'][0]['GatewaySN'] == "30100B14165BCC38" and response['Data']['Items'][0][
        #     'AlarmType'] == "上线", "失败"

    def set_device_statistics(self):
        self.goto_url("alarmManagement/alramAnalyse")
        self.page.get_by_role("textbox", name="请输入所属租户").click()
        self.page.get_by_role("listitem").filter(has_text="中国移动青岛总行").click()
        self.page.get_by_role("textbox", name="请输入项目名称").click()
        self.page.get_by_role("option", name="张院龙").click()
        self.page.get_by_role("button", name=" 查询").click()

    def set_gateway_statistics(self):
        self.goto_url("alarmManagement/alramAnalyse")
        self.page.get_by_role("tab", name="网关统计").click()
